package com.wqw.gpuoverdrawsample;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;

/**
 * 过度绘制演示界面
 * 将屏幕分成5个区域，分别演示不同的过度绘制情况
 * 用WebView显示文字，不会影响绘制层级 （PS：用TextView会）
 * 测试时，请打开“开发者选项”中的“调试GPU过度绘制”的选项
 *
 * @author wangqiuwei
 * @since 2015/9/11
 */
public class OverdrawTestActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView web0 = (WebView) findViewById(R.id.web_0);
        web0.loadDataWithBaseURL(null, "只有窗口背景", "text/html", "UTF-8", null);

        WebView web1 = (WebView) findViewById(R.id.web_1);
        web1.loadDataWithBaseURL(null, "有一层自定义背景", "text/html", "UTF-8", null);

        WebView web2 = (WebView) findViewById(R.id.web_2);
        web2.loadDataWithBaseURL(null, "有两层自定义背景", "text/html", "UTF-8", null);

        WebView web3 = (WebView) findViewById(R.id.web_3);
        web3.loadDataWithBaseURL(null, "有三层自定义背景", "text/html", "UTF-8", null);

        WebView web4 = (WebView) findViewById(R.id.web_4);
        web4.loadDataWithBaseURL(null, "有四层自定义背景", "text/html", "UTF-8", null);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        android.os.Process.killProcess(android.os.Process.myPid());
    }
}
